#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <unordered_set>
#include <unordered_map>
#include <functional>
#include <cmath>
#include <cstring>

using namespace std;

class Solution {
    public:
        int similarPairs(vector<string>& words) {
            unordered_map<int, int> cnt;
            int ans = 0;
            for (auto& s : words) {
                int mask = 0;
                for (char c : s) {
                    mask |= 1 << (c - 'a');
                }
                ans += cnt[mask]++;
            }
            return ans;
        }
    };
    

int main() {
    
    //system("pause");
    return 0;
}

